﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

public partial class DuAnBily : System.Web.UI.MasterPage
{
     SqlConnection conn = new SqlConnection();
     SqlCommand cmd = new SqlCommand();
     SqlDataAdapter da = new SqlDataAdapter();
     DataTable dt = new DataTable();

    protected void Page_Load(object sender, EventArgs e)
    {
          if(!Page.IsPostBack)
          {
              getMenu();
          }
    }

    public DataTable getMenu()
    {
        conn.ConnectionString = ConfigurationManager.ConnectionStrings["PROJECT"].ConnectionString;
        cmd.Connection = conn;
        cmd.CommandText = "select * from MenuItems";
        cmd.CommandType = CommandType.Text;
        da.SelectCommand = cmd;
        da.Fill(dt);
        return dt;
    }

    public DataTable getMenu1()
    {
        conn.ConnectionString = ConfigurationManager.ConnectionStrings["PROJECT"].ConnectionString;
        cmd.Connection = conn;
        cmd.CommandText = "select * from Categories where Type = 'cha1'";
        cmd.CommandType = CommandType.Text;
        da.SelectCommand = cmd;
        da.Fill(dt);
        return dt;
    }

    public DataTable getMenucon1()
    {
        conn.ConnectionString = ConfigurationManager.ConnectionStrings["BilyTeamConnectionString"].ConnectionString;
        cmd.Connection = conn;
        cmd.CommandText = "select * from Categories where  [Type]='con1'";
	 
        cmd.CommandType = CommandType.Text;
        da.SelectCommand = cmd;
        da.Fill(dt);
        return dt;
    }

    public DataTable getMenucon2()
    {
        conn.ConnectionString = ConfigurationManager.ConnectionStrings["BilyTeamConnectionString"].ConnectionString;
        cmd.Connection = conn;
        cmd.CommandText = "select * from Categories where [Type] = 'Vecon1'";
        cmd.CommandType = CommandType.Text;
        da.SelectCommand = cmd;
        da.Fill(dt);
        return dt;
    }
    
}
